package com.itheima.stargraph.config;

import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * OpenAI配置类
 *
 * @Author mr.Du
 * @Date 2025/6/11 2025/6/11
 */
@Configuration
public class OllamaConfig {

    @Value("${ollama.apiUrl}")
    private String ollamaUrl;

    /**
     * 声明OpenAI聊天客户端实例
     * @return
     */
    @Bean
    public OpenAIClient openAIClient() {
        OpenAIClient client = OpenAIOkHttpClient.builder()
                .apiKey("aaa")
                .baseUrl(ollamaUrl)
                .build();
        return client;
    }
}
